import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);


const state = {
    count:1
}

const mutations = {
    increment(state) {
        state.count++
    },
    decrement(state){
        state.count--
    }
}
 const actions = {
     increment:({commit}) =>{
         commit("increment")//对应mutations里面的increment
     },
     decrement:({commit}) =>{
        commit("decrement")//对应mutations里面的decrement
    }
 }
 export default new Vuex.Store({
    state,
    mutations,
    actions
 })

 